<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        /* #onename {
            color: mediumaquamarine;
        } */
    </style>
</head>

<body>

    用户名<input type="text" id="onename">6-30位字母、数字或“_”,字母开头
    <br> 登录密码 <input type="text" id="paw">
    <br> 确认登录密码 <input type="text" id="paw2">
    <br> 证件类型
    <select name="cars">
        <option value="volvo">中国居民身份证</option>
        <option value="saab">港澳居民</option>
        <option value="fiat">台湾居民</option>
        <option value="audi">护照</option>
        </select>
    <br> 姓名<input type="text" id="name">
    <br> 证件号码<input type="text" id="id">
    <br>邮箱 <input type="text" id="email">
    <br>手机号码 <input type="text" id="Tel">


</body>

</html>
<script src="../jq第一天/jquery-3.4.1.min.js"></script>

<script>
    $("#onename").blur(function() {
        var re1 = /(^[a-z])\w{5,29}$/i;
        // console.log($("#onename").val())
        // console.log(re1.test($("#onename").val()))
        if (re1.test($("#onename").val())) {
            $(this).css({
                color: "mediumaquamarine",
            })
        } else {
            $(this).css({
                color: "tomato",
            })
        }
    })
    $("#paw").blur(function() {
        var re2 = /^.{6,12}$/
        console.log(re2.test($("#paw")));
    })
    $("#paw2").blur(function() {
        // var re2 = /.{6,12}/
        console.log($("#paw").val() == $("#paw2").val());
    })
    $("#name").blur(function() {
        var re3 = /^[A-Z][a-z]+$|^[\u4e00-\u9fa5]+$/;
        console.log($("#name").val());
        console.log(re3.test($("#name").val()));
    })
    $("#id").blur(function() {
        // var re4 = /^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]/
        var re5 = /^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/
        console.log(re5.test($("#id").val()));
    })
    $("#email").blur(function() {
        var re6 = /^/
    })
</script>